/*
 * @Author: humengchuan 531537052@qq.com
 * @Date: 2025-01-04 20:02:35
 * @LastEditors: humengchuan 531537052@qq.com
 * @LastEditTime: 2025-01-25 20:52:33
 * @FilePath: \project-my\vue-mall\src\router\index.ts
 * @Description: 
 */
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'home',
        component: () => import('@/views/layout/index.vue'),
        children: [
            {
                path: '/',
                name: 'index',
                component: () => import('@/views/home/graph.vue')
            }
        ]
    },
    {
        path: '/login',
        name: 'login',
        component: () => import('@/views/login/index.vue')
    },
    {
        path: '/action',
        name: 'action',
        component: () => import('@/views/action/index.vue')
    }
    // {
    //     path: '/:pathMatch(.*)*',
    //     name: '404',
    //     component: () => import('../views/404.vue')
    // },
] 

const router = createRouter({
  history: createWebHashHistory(),
  routes,
  //  跳转路由后默认到顶部
  scrollBehavior: () => {
    return { top: 0 }
  }
})

export default router